<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/basePath.jsp"%>
<%@ include file="/classes/CommonHelper.class.jsp" %>
<%@ include file="/classes/DBHelper.class.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	//查询分类
	String sql = "select * from APP_ZSPJ_TYPE order by order_num";
	List<Map<String,Object>> list = queryForList(sql);
	pageContext.setAttribute("list",list);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>知识普及-新增</title>
<script type="text/javascript" src="../js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="../js/jquery.form.js"></script>
<script type="text/javascript">

function toSubmit(){
	if($("#question").val()==""){
		alert("请输入问题？");
		return false;
	}
	if($("#answer").val()==""){
		alert("请输入答案？");
		return false;
	}
	if($("#answer").val().length>2000){
		alert("答案长度不能超过2000个字？");
		return false;
	}
	return true;
}
</script>
<link rel="stylesheet" type="text/css" href="../css/mytable.css"></link>
</head>
<body>
<form id="myForm" action="zspj_adddo.class.jsp" method="post" onsubmit="return toSubmit()">
	<table id="mytable" cellspacing="0" summary="The technical specifications of the Apple PowerMac G5 series"> 
		<caption> </caption> 
		<tr>
			<th scope="col"  class="nobg"></th>
			<th class="nobg">
				知识普及--新增
			</th>
		</tr>
		<tr>
			<th scope="col">类别：</th>
			<td class="specalt">
				<select name="type_id" style="width: 200px">
					<c:forEach items="${list }" var="type">
					<option value="${type.guid }">${type.type_name }</option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<th scope="col">问题：</th>
			<td class="specalt"> <input type="text" id="question" name="question" style="width: 200px" maxlength="100"/> </td>
		</tr>
		<tr>
			<th scope="col">答案：</th>
			<td class="specalt"> 
			<textarea id="answer" name="answer" style="width: 400px;height: 150px" ></textarea>
			</td>
		</tr>
		<tr>
			<th scope="col">提供部门名称：</th>
			<td class="specalt">
			<input type="text" id="dept_name" name="dept_name" style="width: 200px" maxlength="100"/>
			</td>
		</tr>
		<tr>
			<td class="specalt"></td>
			<td class="specalt"> <input id="submit" type="submit" value="提交" />
			<input type="button" value="返回列表页"  onclick="window.location.href='zspj_list.jsp?r=<%=new Date().getTime() %>'"/>
			 </td>
		</tr>
	</table>
</form>
</body>
</html>